<template>
  <div class="distribution-wrapper step_line">
    <div style="width: 100%">
      <div style="padding: 20px">
        <SingleArrival
          :companyData="companyData"
          :dmode="mode"
          :driverData="driverData"
          :carNumberData="carNumberData"
        >
        </SingleArrival>
        <el-form
          :model="ruleForm"
          label-position="top"
          :rules="rules"
          ref="ruleForm"
          class="demo-form-inline inputForm"
          :disabled="disable"
        >
          <div class="info_tab">配送信息</div>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="配送单号" prop="number">
                <el-input
                  id="distribution_batch"
                  v-model="ruleForm.number"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="配送类型" prop="type">
                <el-select
                  id="distribution_type_down"
                  :disabled="typeDisable"
                  v-model="ruleForm.type"
                  @change="handleChangeType"
                  placeholder="请选择"
                >
                  <el-option
                    id="distribution_type"
                    v-for="item in types"
                    :label="item.value"
                    :value="item.index"
                    :key="item.index"
                    >{{ item.value }}</el-option
                  >
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="配送公司"
                :class="{
                  'select-add': isHavePermission('company_carrier_create'),
                }"
                
                prop="company_id"
                v-if="ruleForm.type == '1'"
              >
                <el-select
                  id="distribution_company_down"
                  v-model="ruleForm.company_id"
                  class="select-left"
                  @change="handleChangeCompany"
                  filterable
                  clearable
                  placeholder="请选择"
                >
                  <el-option
                    id="distribution_company"
                    v-for="item in companyData"
                    :label="item.name"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.name }}</el-option
                  >
                </el-select>
                <el-button
                  v-permission="'company_carrier_create'"
                  @click="handleAddMaterial('carrier')"
                  class="add-right"
                  >+</el-button
                >
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="ruleForm.type == '0'">
              <el-form-item label="配送网点" prop="to_network_id">
                <el-cascader
                  id="to_network"
                  popper-class="to_network"
                  ref="cascader"
                  @change="handleChangeNetwork()"
                  style="width: 100%"
                  :options="branchData"
                  :show-all-levels="false"
                  v-model="ruleForm.to_network_id"
                  :props="{
                    emitPath: false,
                    checkStrictly: true,
                    label: 'branch_name',
                    value: 'id',
                    children: 'next_level_data',
                  }"
                  clearable
                >
                </el-cascader>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="配送始发地址" prop="address_start">
                <el-input
                  id="from_address"
                  v-model="ruleForm.address_start"
                  @change="invokingNumber()"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="配送目的地址" prop="address_end">
                <el-input
                  id="to_address"
                  v-model="ruleForm.address_end"
                  @change="invokingNumber()"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="配送发车时间" prop="depart_time">
                <el-date-picker
                  id="depart_time"
                  v-model="ruleForm.depart_time"
                  type="datetime"
                  placeholder="选择日期时间"
                  width="180px"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="预计配送完成时间" prop="scheduled_end_time">
                <el-date-picker
                  id="scheduled_end_time"
                  v-model="ruleForm.scheduled_end_time"
                  type="datetime"
                  placeholder="选择日期时间"
                  width="180px"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="配送司机"
                prop="motorist_id"
                :class="{
                  'select-add': isHavePermission('company_driver_create'),
                }"
                :rules="ruleForm.type == '0' ? rules.motorist_id : {}"
              >
                <el-select
                  id="collect_driver_down"
                  v-model="ruleForm.motorist_id"
                  class="select-left"
                  placeholder="请选择"
                  filterable
                  @change="handleChangeDriver"
                >
                  <el-option
                    id="collect_driver"
                    v-for="item in driverData"
                    :label="item.name"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.name }}</el-option
                  >
                </el-select>
                <el-button
                  v-permission="'company_driver_create'"
                  @click="handleAddMaterial('driver')"
                  class="add-right"
                >
                  +
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item
                label="配送司机电话"
                prop="mobile"
                :rules="ruleForm.type == '0' ? rules.mobile : {}"
              >
                <el-input
                  id="driver_phone"
                  v-model="ruleForm.mobile"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="配送车牌号"
                prop="car_no_id"
                :class="{
                  'select-add': isHavePermission('company_vehicle_create'),
                }"
                :rules="{
                  required: [2, 4].indexOf(this.businessType) > -1,
                  message: '请选择配送车牌号',
                  trigger: 'change',
                }"
              >
                <el-select
                  id="collect_car_no_down"
                  v-model="ruleForm.car_no_id"
                  class="select-left"
                  @change="selectCarNumber"
                  filterable
                  placeholder="请选择"
                >
                  <el-option
                    id="collect_car_no"
                    v-for="item in carNumberData"
                    :label="item.license_plate"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.license_plate }}</el-option
                  >
                </el-select>
                <el-button
                  v-permission="'company_vehicle_create'"
                  @click="handleAddMaterial('car')"
                  class="add-right"
                  >+</el-button
                >
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item
                label="承运单号"
                prop="carrier_number"
                v-if="ruleForm.type == '1'"
              >
                <el-input
                  id="carrier_number"
                  v-model="ruleForm.carrier_number"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="创建时间" prop="create_time">
                <el-date-picker
                  v-model="ruleForm.create_time"
                  clearable
                  type="datetime"
                  placeholder="选择日期时间"
                  value-format="timestamp"
                  :disabled="mode === 'edit' || mode === 'singleEdit'"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col
              :span="6"
              v-if="mode === 'detail' || mode === 'singleDetail'"
            >
              <el-form-item label="操作时间" prop="update_time">
                <el-date-picker
                  :value="ruleForm.update_time * 1000"
                  type="datetime"
                  placeholder="选择日期时间"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col
              :span="6"
              v-if="
                (mode === 'detail' || mode === 'singleDetail') &&
                ruleForm.status === '1'
              "
            >
              <el-form-item label="实际配送完成时间" prop="arrive_time">
                <el-date-picker
                  :value="ruleForm.arrive_time * 1000"
                  type="datetime"
                  placeholder="选择日期时间"
                  value-format="timestamp"
                >
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="info_tab">负责人信息</div>
          <el-row :gutter="24">
            <el-col :span="6">
              <el-form-item label="运营负责人" prop="operation_id">
                <el-select
                  v-model="ruleForm.operation_name"
                  filterable
                  remote
                  :remote-method="(val) => remoteMethod(val, 'operation')"
                  placeholder="请选择"
                  @change="(val) => handleChangeCharge(val, 'operation')"
                >
                  <el-option
                    v-for="item in motionData"
                    :label="item.name"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.name }}</el-option
                  >
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="运营负责人电话" prop="operation_phone">
                <el-input v-model="ruleForm.operation_phone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="操作人" prop="action_id">
                <el-select
                  v-model="ruleForm.action_name"
                  filterable
                  remote
                  :remote-method="remoteMethod"
                  placeholder="请选择"
                  @change="(val) => handleChangeCharge(val, 'action')"
                >
                  <el-option
                    v-for="item in chargeData"
                    :label="item.name"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.name }}</el-option
                  >
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="操作人电话" prop="action_phone">
                <el-input v-model="ruleForm.action_phone"></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="调度人" prop="dispatch_id">
                <el-select
                  v-model="ruleForm.dispatch_name"
                  filterable
                  remote
                  :remote-method="remoteMethod"
                  placeholder="请选择"
                  @change="(val) => handleChangeCharge(val, 'dispatch')"
                >
                  <el-option
                    v-for="item in chargeData"
                    :label="item.name"
                    :value="item.id + ''"
                    :key="item.id"
                    >{{ item.name }}</el-option
                  >
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="调度人电话" prop="dispatch_phone">
                <el-input v-model="ruleForm.dispatch_phone"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <div class="info_tab">
            <div>费用信息</div>
            <div class="info_tab_list" v-show='isAccordRule'>
              <div>计费规则：</div>
              <div>
                <el-select v-model="curRuleCostId" style="width:150px" clearable placeholder="请选择" @change="rulechange">
                  <el-option v-for="(item,index) in ruleCostInfo" :key="index" :label="item.rule_name" :value="item.rule_id">
                  </el-option>
                </el-select>
              </div>
              <div v-if="curRuleCost.cost" style="margin-left:30px">
                建议价格：
                {{curRuleCost.cost}}元
              </div>
            </div>
          </div>
          <div
            style="margin-bottom: 10px"
            v-if="!disable && ruleForm.is_add_waybill !== '1'"
          >
            <el-button
              type="primary"
              plain
              size="mini"
              @click="handleAddWaybill"
              >新增运单</el-button
            >
            <el-button
              type="primary"
              plain
              size="mini"
              @click="handleDelWaybill"
              >删除运单</el-button
            >
          </div>
          <el-table
            :data="ruleForm['waybill_data_list']"
            :default-expand-all="this.is_incubator"
            @selection-change="handleSelectionChange"
            class="safari_table"
            style="width: 100%; margin-bottom: 20px"
            :key="is_incubator + ''"
          >
            <el-table-column type="expand">
              <template slot-scope="props">
                <el-table
                  :data="props.row.goods"
                  style="width: 100%"
                  v-if="props.row.goods"
                  :show-header="false"
                >
                  <el-table-column label="操作" prop="" width="98">
                    <!-- <template slot-scope="scope">
                 <el-button size="mini" style="padding:4px" circle @click="handleAddGood(props.row.goods)"> <i class="el-icon-plus"></i> </el-button>
                 <el-button size="mini" style="padding:4px" circle @click="handleDelGood(props.row.goods,scope.$index)"><i class="el-icon-minus"></i></el-button>
                </template> -->
                  </el-table-column>
                  <el-table-column
                    label="货物名称"
                    prop="name"
                    width="120"
                    :show-overflow-tooltip="true"
                  >
                    <template slot-scope="scope">
                      <!-- <el-input v-model="scope.row['name']"></el-input> -->
                      {{ scope.row["name"] }}
                    </template>
                  </el-table-column>
                  <el-table-column label="件数" prop="number" width="100">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row['number']"
                        oninput="value=value.replace(/[^\d]/g,'')"
                        @input="handleInputTotal"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="重量" prop="weight" width="100">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row['weight']"
                        oninput="value=value.replace(/[^\d^\.]/g,'')"
                        @input="handleInputTotal"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="体积" prop="volume" width="100">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row['volume']"
                        oninput="value=value.replace(/[^\d^\.]/g,'')"
                        @input="handleInputTotal"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <template v-if="is_incubator">
                    <el-table-column
                      label="温层"
                      prop="thermosphere"
                      width="120"
                    >
                      <template slot-scope="scope">
                        <el-select
                          v-model="scope.row['thermosphere']"
                          disabled
                          placeholder="请选择"
                          clearable
                          filterable
                        >
                          <el-option
                            v-for="item in thermosphereData"
                            :label="item.item_name"
                            :value="item.item_code"
                            :key="item.item_code"
                            >{{ item.item_name }}</el-option
                          >
                        </el-select>
                      </template>
                    </el-table-column>
                    <el-table-column
                      label="包装型号"
                      width="140"
                      prop="package_type"
                    >
                      <template slot-scope="scope">
                        <el-select
                          v-model="scope.row['package_type']"
                          disabled
                          placeholder="请选择"
                          clearable
                          filterable
                        >
                          <el-option
                            v-for="item in packageData"
                            :label="item.item_name"
                            :value="item.item_code"
                            :key="item.item_code"
                            >{{ item.item_name }}</el-option
                          >
                        </el-select>
                      </template>
                    </el-table-column>
                  </template>
                  <template v-else>
                    <el-table-column label="货物包装" width="100">
                      <template slot-scope="scope">
                        <el-select
                          v-model="scope.row.packing"
                          disabled
                          clearable
                          placeholder=""
                        >
                          <el-option label="纸箱" value="0"> </el-option>
                          <el-option label="木箱" value="1"> </el-option>
                          <el-option label="纤袋" value="2"> </el-option>
                        </el-select>
                      </template>
                    </el-table-column>
                  </template>

                  <el-table-column label="包装数量" width="100">
                    <template slot-scope="scope">
                      <el-input
                        v-model="scope.row['package_quantity']"
                        oninput="value=value.replace(/[^\d]/g,'')"
                        @input="handleInputTotal"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="温度计" width="100">
                    <template slot-scope="scope">
                      <el-tooltip
                        class="item"
                        effect="dark"
                        :content="
                          getTheroName(scope.row.waybill_devices) ||
                          '温度计绑定'
                        "
                        placement="top"
                      >
                        <div
                          @click="is_incubator && handleClickBind(scope.row)"
                        >
                          <el-input
                            :disabled="!is_incubator"
                            :value="getTheroName(scope.row.waybill_devices)"
                          ></el-input>
                        </div>
                      </el-tooltip>
                    </template>
                  </el-table-column>
                  <el-table-column label=""> </el-table-column>
                </el-table>
              </template>
            </el-table-column>
            <el-table-column type="selection" width="50"></el-table-column>
            <el-table-column label="运单号" width="120">
              <template slot-scope="scope">
                {{ scope.row["waybill_no"] }}
              </template>
            </el-table-column>
            <el-table-column label="件数" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['number']"
                  disabled
                  @change="invokingNumber()"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="重量（kg）" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['weight']"
                  disabled
                  @change="invokingNumber()"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="体积（m³）" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['volume']"
                  disabled
                  @change="invokingNumber()"
                ></el-input>
              </template>
            </el-table-column>
            <!-- 保温箱 -->
            <template v-if="is_incubator">
              <el-table-column label="温层" width="120">
                <el-input disabled></el-input>
              </el-table-column>
              <el-table-column label="包装型号" width="140">
                <el-input disabled></el-input>
              </el-table-column>
            </template>
            <!-- 非保温箱 -->
            <el-table-column label="货物包装" width="100" v-else>
              <el-input disabled></el-input>
            </el-table-column>
            <el-table-column label="包装数量" width="100">
              <template slot-scope="scope">
                <el-input
                  disabled
                  v-model="scope.row['package_quantity']"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="温度计" width="100">
              <template slot-scope="scope">
                <el-tooltip
                  class="item"
                  effect="dark"
                  :content="
                    getTheroName(scope.row.waybill_devices) || '温度计绑定'
                  "
                  placement="top"
                >
                  <div @click="!is_incubator && handleClickBind(scope.row)">
                    <el-input
                      :disabled="is_incubator"
                      :value="
                        !is_incubator
                          ? getTheroName(scope.row.waybill_devices)
                          : ''
                      "
                    ></el-input>
                  </div>
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column
              label="配送费"
              prop="delivery_money"
              property="delivery_money"
              width="100"
            >
              <template #header>
                <div v-if="rules.delivery_money[0].required">
                  <span style="color: red">*</span> <span>配送费</span>
                </div>
                <div v-else>
                  <span>配送费</span>
                </div>
              </template>
              <template slot-scope="scope">
                <el-form-item
                  style="margin-bottom: 1px"
                  :prop="
                    'waybill_data_list.' + scope.$index + '.delivery_money'
                  "
                  :rules="rules.delivery_money"
                >
                  <el-input
                    id="distribution_delivery_money"
                    v-model="scope.row['delivery_money']"
                    oninput="value=value.replace(/[^\d^\.]/g,'')"
                  ></el-input>
                </el-form-item>
              </template>
            </el-table-column>
            <el-table-column label="里程费" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['extra_distribution_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="二次配送费" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['second_distribution_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="专车费" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['waiting_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="机场提货费" width="100">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['airport_pick_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="干冰费" width="100" prop="dry_ice_fee">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['dry_ice_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="返箱费" width="100" prop="return_box_money">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['return_box_money']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="机场操作费" width="100" prop="airport_operate_fee">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['airport_operate_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label="中转费" width="100" prop="transfer_fee">
              <template slot-scope="scope">
                <el-input
                  v-model="scope.row['transfer_fee']"
                  oninput="value=value.replace(/[^\d^\.]/g,'')"
                ></el-input>
              </template>
            </el-table-column>
            <el-table-column label=""> </el-table-column>
          </el-table>
          <div
            style="margin-top: 20px; text-align: right; padding-bottom: 20px"
            v-if="!disable"
          >
            <el-button id="create_cancel" @click="$emit('update')"
              >取消</el-button
            >
            <el-button
              id="create_ok"
              type="primary"
              v-preventReClick
              data-tracker="P4-3"
              @click="submitForm"
              :loading="submitLoading"
              >{{ mode === "add" ? "开始配送" : "修改" }}</el-button
            >
          </div>
        </el-form>
      </div>
      <OperationWaybill
        step="3"
        :key="Math.random()"
        :waybill_product_type="waybillInfo.waybill_product_type"
        @close="handleOperationClose"
        @finish="handleOperationWaybillOk"
        v-if="waybillDialogShow"
        :visible="waybillDialogShow"
        :restParams="{
          to_network_id_list: [this.waybillInfo.to_network_id * 1],
        }"
      >
      </OperationWaybill>
      <MaterialAdd
        :type="materialType"
        @ok="handleMaterialAddOk"
        @close="handleCloseMaterialDialog"
        :dialogVisible="materialDialogVisible"
        :diaremark="3"
      >
      </MaterialAdd>
    </div>
    <div>
      <notify
        v-if="notifyType"
        :noTifyData="noTifyData"
        :key="noTifyData.node_id"
      ></notify>
    </div>
    <CostControl :showDialog="costDialogShow"  :overWarning="overWarning" :tableData="cost_overruns_info" @ok="handleCostOk" @close="costDialogShow=false"></CostControl>

  </div>
</template>

<script>
import {
  DistributionAddFn,
  waybillRepo,
  DistributionDetailFn,
  DistributionEditFn,
  distributionEditOne,
  carrierBox,
  driverBox,
  vehicleBox,
  getChargeDataBox,
  waybillExpectTime,
  searchChargeData,
  accountingrules, //计费规则接口
  recognitionListcity, //通过详细地址获取省市区的id
  DefaultPersonList,
  FeeEntryControl,
} from "@/api/waybill";
import { detailsDriver } from "@/api/information";
import SingleArrival from "./singleArrival.vue";
import { dictionanryList } from "@/page/material/common/common";
import {
  timestamp10,
  parseFen,
  parseYuan,
  commonAddMulty,
  commonAdd,
} from "@/utils/mUtils";
import OperationWaybill from "../operationWaybill.vue";
import { organizationBox } from "@/api/organization";
import MaterialAdd from "../materialAdd.vue";
import { MATERIAL } from "@/page/waybill/constants";
import { isHavePermission } from "@/utils/mUtils";
import notify from "@/components/notify/notify.vue"; // 时间转化
import CostControl from "../costControl.vue";

export default {
  name: "singleDistribution",
  components: { SingleArrival, OperationWaybill, MaterialAdd, notify ,CostControl},
  props: [
    "id",
    "mode",
    "ids",
    "type",
    "waybillInfo",
    "is_incubator",
    "businessType",
  ],
  inject: ["bindTemp"],
  data() {
    return {
      submitLoading: false,
      ruleForm: {
        // address_end: "1",
        // address_start: "1",
        // car_no_id: "12",
        // charges_id: "7",
        // price: "装卸费",
        // cost_id: "4",
        // company: "1",
        // cost_way: "4",
        // mobile: "13403612917",
        // motorist_id: "11",
        // peron: "123",

        // scheduled_end_time: "1655965375000",
        // depart_time: "1655965373000",
        // temp_status_way: "3",
        waybill_data_list: [],
        scheduled_end_time: "",
        operation_name: "",
        operation_phone: "",
        action_name: "",
        action_phone: "",
        dispatch_name: "",
        dispatch_phone: "",
        address_start: "",
        address_end: "",
        mobile: "",
        type: "0", //
        carrier_number: "", //承运单号
        to_network_id: "", //揽收网点
        to_network_name: "", //揽收网点名字
        address_start: "",
        motorist_id: "",
        peron: "",
        create_time: "", //创建时间
      },
      rules: {
        company_id: [
          { required: true, message: "请选择配送公司", trigger: ["change","blur"] },
        ],
        car_no_id: [
          { required: true, message: "请填写配送车牌号", trigger: "blur" },
        ],
        address_start: [
          { required: true, message: "请填写配送始发地址", trigger: "blur" },
        ],
        address_end: [
          { required: true, message: "请填写配送目的地址", trigger: "blur" },
        ],
        depart_time: [
          { required: true, message: "请填写配送发车时间", trigger: "blur" },
        ],
        scheduled_end_time: [
          {
            required: true,
            message: "请填写预计配送完成时间",
            trigger: "blur",
          },
        ],
        temp_status_way: [
          { required: true, message: "请选择温度状态", trigger: "change" },
        ],
        cost_way: [
          { required: true, message: "请选择费用分摊方式", trigger: "change" },
        ],
        charges_id: [
          { required: true, message: "请选择付款方式", trigger: "change" },
        ],
        delivery_money: [
          { required: false, message: "请填写基础配送费", trigger: "blur" },
        ],
        carrier_number: [
          { required: true, message: "请填写承运单号", trigger: "blur" },
        ],
        motorist_id: [
          { required: true, message: "请填写配送司机", trigger: "change" },
        ],
        mobile: [
          { required: true, message: "请填写配送司机电话", trigger: "blur" },
        ],
        to_network_id: [
          { required: true, message: "请填写配送网点", trigger: "change" },
        ],
        type: [{ required: true, message: "请填写配送类型", trigger: "blur" }],
      },
      driverData: [],
      carNumberData: [],
      thermosphereData: [],
      paymentData: [],
      companyData: [],
      costData: [],
      chargeData: [],
      motionData: [],
      packageData: [],
      arrivalForm: {}, //到港入库formdata
      endareaList: {}, //目的地址
      startareaList: {}, //始发地址
      rule_cost_info: [], //计费规则
      rule_cost_info_id: "",
      waybillDialogShow: false,
      checkedRows: [],
      types: [
        {
          index: "0",
          value: "自营",
        },
        {
          index: "1",
          value: "委外",
        },
      ],
      branchData: [],
      materialType: "",
      materialDialogVisible: false,
      MATERIAL: MATERIAL,
      typeDisable: false,
      notifyType: false,
      noTifyData: {
        customer_id: "",
        product_type_id: "",
        node_id: "",
      },
      overWarning:"",
      cost_overruns_info:[
        ],//成本超出信息
      costDialogShow:false,
      startAreaInfo:{},
      ruleCostInfo:[],
      curRuleCost:{rule_id:"",rule_name:""},
      curRuleCostId:""
    };
  },
  computed: {
    name() {
      return this.data;
    },
    disable: function () {
      return this.mode === "detail" || this.mode === "singleDetail";
    },
    // 承运商和组织的符合，用于监听这两个字段是否发生变化
    driverEngine() {
      return Number(this.ruleForm.company_id) || this.ruleForm.to_network_id;
    },
    isAccordRule() {
      // 保温箱 + 委外
      return this.is_incubator&&this.ruleForm.type=='1'
    }
  },
  watch: {
    id: {
      handler: function (val) {
        val && this.getDetail();
      },
      immediate: true,
    },
    mode: {
      handler: function () {
        this.handleChangeMode();
      },
      immediate: true,
    },
    driverEngine(val) {
      if (val) {
        this.getDriverBox();
      } else {
        this.driverData = [];
        this.checkDriverId();
      }
    },
  },
  mounted() {
    // 修改
    // this.handleChangeMode();
    // driverBox().then((res) => {
    //   this.driverData = res.data;
    // });
    vehicleBox().then((res) => {
      this.carNumberData = res.data;
    });

    carrierBox().then((res) => {
      this.companyData = res.data;
    });
    dictionanryList([
      "thermosphere",
      "divide_way",
      "pay_way",
      "Package_model",
    ]).then((res) => {
      this.thermosphereData = res.data.list["thermosphere"];
      this.paymentData = res.data.list["divide_way"];
      this.costData = res.data.list["pay_way"];
      this.packageData = res.data.list["Package_model"];
    });
    organizationBox({ not_show_first_branch: 1 }).then((res) => {
      this.branchData = res.data;
      if (this.mode === "add") {
        this.handleChangeType();
      }
    });
    FeeEntryControl({}).then((res) => {
      const data = res.data || {};
      this.rules.delivery_money[0].required =
        data.switch_status == "0" ? true : false;
    });
    this.NotificationObj();
  },
  methods: {
    isHavePermission(val) {
      return isHavePermission(val);
    },
    async setDefaultCompany() {
      const user = JSON.parse(localStorage.getItem("user")) || {};
      let driverInfo;
      if (user.type === 2) {
        const res = await detailsDriver({ id: user.type_id });
        driverInfo = res.data;
      }
      // 承运商 || 外部司机
      if (
        user.type === 3 ||
        (user.type === 2 && driverInfo.driver_type === "1")
      ) {
        // 默认委外
        this.ruleForm.type = "1";
        // 置灰
        this.typeDisable = true;
        // 承运商默认
        this.ruleForm.company_id =
          user.type === 3 ? user.type_id + "" : driverInfo.carrier_id + "";
        this.handleChangeCompany(this.ruleForm.company_id);
      }
    },
    handleChangeMode() {
      if (
        this.mode === "edit" ||
        this.mode === "detail" ||
        this.mode === "singleDetail" ||
        this.mode === "singleEdit"
      ) {
        this.getDetail();
        // 创建
      } else if (this.mode === "add") {
        this.getWaybillDataByIds(this.ids);
        this.ruleForm.address_end = (
          (this.waybillInfo || {}).receiver || {}
        ).address;
        this.getExpectTime();
        // 默认负责人
        this.setDefaultPerson();
        // 默认承运商
        this.setDefaultCompany();
        this.ruleForm.create_time = Date.now();
      }
    },
    handleAddGood(goods) {
      goods.push({});
    },
    handleDelGood(goods, index) {
      if (goods.length === 1) {
        this.$message({
          message: "最后一条数据，不允许删除",
          type: "warning",
        });
        return;
      }
      goods.splice(index, 1);
      this.handleInputTotal();
    },
    getTheroName(devices) {
      const _devices = devices || [];
      return _devices.map((item) => item.thermometer_no).join(",");
    },

    handleInputTotal() {
      this.ruleForm.waybill_data_list.forEach((waybill) => {
        waybill.number =
          waybill.goods &&
          waybill.goods.reduce((prev, next) => {
            return commonAdd(prev, next.number * 1);
          }, 0) + "";
        waybill.weight =
          waybill.goods &&
          waybill.goods.reduce((prev, next) => {
            return commonAdd(prev, next.weight * 1);
          }, 0) + "";
        waybill.volume =
          waybill.goods &&
          waybill.goods.reduce((prev, next) => {
            return commonAdd(prev, next.volume * 1);
          }, 0) + "";
        waybill.package_quantity =
          waybill.goods &&
          waybill.goods.reduce((prev, next) => {
            return commonAdd(prev, next.package_quantity * 1);
          }, 0) + "";
      });
      this.getFeeRules()
    },
    handleAddMaterial(materialType) {
      this.materialType = materialType;
      this.materialDialogVisible = true;
    },
    handleCloseMaterialDialog() {
      this.materialDialogVisible = false;
    },
    handleMaterialAddOk() {
      const { MATERIAL } = this;
      if (this.materialType === MATERIAL.CAR) {
        this.getCarBox();
      } else if (this.materialType === MATERIAL.DRIVER) {
        this.getDriverBox();
      } else if (this.materialType === MATERIAL.CARRIER) {
        this.getCarrierBox();
      }
    },
    getCarBox() {
      vehicleBox().then((res) => {
        this.carNumberData = res.data;
      });
    },
    getDriverBox() {
      let carrier_id;
      if (this.ruleForm.type === "0") {
        carrier_id = this.ruleForm.to_network_id + "";
      } else {
        carrier_id = this.ruleForm.company_id;
      }
      driverBox({
        driver_type: this.ruleForm.type,
        carrier_id,
      }).then((res) => {
        this.driverData = res.data;
        this.checkDriverId();
      });
    },
    // 校验司机id是否在data中，没有清空
    checkDriverId() {
      const isInData =
        this.driverData.findIndex(
          (item) => item.id === this.ruleForm.motorist_id * 1
        ) > -1;
      if (!isInData) {
        this.ruleForm.motorist_id = ""; // 揽收司机
        this.ruleForm.peron = "";
      }
    },
    getCarrierBox() {
      carrierBox().then((res) => {
        this.companyData = res.data;
      });
    },
    setDefaultPerson() {
      DefaultPersonList({ waybill_id: this.waybillInfo.id * 1 }).then((res) => {
        if (res.code === 10000) {
          const { action_info, dispatch_info, operation_info } =
            res.data.data || {};
          if (operation_info) {
            this.ruleForm.operation_id = operation_info.id + "";
            this.ruleForm.operation_name = operation_info.name;
            this.ruleForm.operation_phone = operation_info.mobile;
          }
          if (action_info) {
            this.ruleForm.action_id = action_info.id + "";
            this.ruleForm.action_name = action_info.name;
            this.ruleForm.action_phone = action_info.mobile;
          }
          if (dispatch_info) {
            this.ruleForm.dispatch_id = dispatch_info.id + "";
            this.ruleForm.dispatch_name = dispatch_info.name;
            this.ruleForm.dispatch_phone = dispatch_info.mobile;
          }
        }
      });
    },

    remoteMethod(nickname, key, params = {}) {
      searchChargeData({ nickname, ...params }).then((res) => {
        if (key === "operation") {
          this.motionData = res.data;
        } else {
          this.chargeData = res.data;
        }
      });
    },
    handleChangeNetwork(val, a) {
      const checkedNodes =
        (this.$refs["cascader"].getCheckedNodes() || [])[0] || {};
      const checkedData = checkedNodes.data;
      if (checkedData) {
        this.ruleForm.to_network_name = checkedData.branch_name;
        // 配送始发地址默认为配送网点在组织架构的地址
        this.ruleForm.address_start = checkedData.address;
      }
    },
    handleChangeType() {
      if (this.ruleForm.type == "0") {
        if (
          this.waybillInfo.to_network_id !== "" &&
          this.waybillInfo.to_network_id !== "0"
        ) {
          this.ruleForm.to_network_id = this.waybillInfo.to_network_id * 1;
          this.$nextTick(() => {
            this.handleChangeNetwork();
          });
        }

      } else if (this.ruleForm.type == "1") {
        this.ruleForm.to_network_id = "";
        this.ruleForm.to_network_name = "";
        this.ruleForm.address_start = "";
      }
    },
    handleChangeCharge(val, key) {
      const chargeData =
        key === "operation" ? this.motionData : this.chargeData;
      const charge = chargeData.find((item) => item.id === Number(val));
      if (charge) {
        this.ruleForm[key + "_phone"] = charge.mobile;
        this.ruleForm[key + "_name"] = charge.name;
        this.ruleForm[key + "_id"] = charge.id + "";
      }
    },
    getExpectTime() {
      waybillExpectTime({
        warning_type: "4",
        Waybill_type: "0",
      }).then((res) => {
        if (res.code === 10000 && res.data.estimated_time) {
          this.ruleForm.scheduled_end_time = res.data.estimated_time * 1000;
        }
      });
    },
    getDetail() {
      if (!this.id) return;
      const params =
        this.mode === "singleDetail"
          ? { waybill_id: this.$route.query.id }
          : {};
      DistributionDetailFn({ id: this.id, ...params }).then((res) => {
        const data = res.data;
        if(!data) return;
        data.depart_time = data.depart_time * 1000;
        data.create_time = data.create_time * 1000;
        data.scheduled_end_time = data.scheduled_end_time * 1000;
        data.waybill_data_list = data.waybill_data;
        data.waybill_data_list.forEach((item) => {
          item.delivery_money = parseYuan(item.delivery_money);
          item.extra_distribution_fee = parseYuan(item.extra_distribution_fee);
          item.second_distribution_fee = parseYuan(
            item.second_distribution_fee
          );
          item.waiting_fee = parseYuan(item.waiting_fee);
          item.total_expense = parseYuan(item.total_expense);
          item.goods = item.goods || [];
        });
        data.to_network_id = data.to_network_id * 1;
        this.ruleForm = data;
        this.invoking();
      });
    },
    handleCostOk(cost_overruns_info){
      this.ruleForm.waybill_cost_overruns_info=cost_overruns_info;
      this.submitForm()
    },
    judgeOver(res){
      if(res.data.warning){
        this.costDialogShow=true;
        this.overWarning=res.data.warning;
        this.cost_overruns_info=res.data.cost_overruns_info||[];
        this.submitLoading = false;
        return true;
      }
      return false
    },
    submitForm() {
      this.$refs["ruleForm"].validate((valid) => {
        if (!valid) return;
        this.submitLoading = true;
        // this.ruleForm.car_no_id = this.ruleForm.car_no_id + "";
        const _ruleForm = {
          ...this.ruleForm,
          car_no: this.carNumberName,
          create_time: timestamp10(this.ruleForm.create_time),
          depart_time: timestamp10(this.ruleForm.depart_time),
          scheduled_end_time: timestamp10(this.ruleForm.scheduled_end_time),
          waybill_data_list: JSON.parse(
            JSON.stringify(this.ruleForm.waybill_data_list)
          ),
          to_network_id: this.ruleForm.to_network_id + "",
          to_network_name: this.ruleForm.to_network_name,
        };
        if (this.is_incubator) {
          for (let i = 0; i < _ruleForm.waybill_data_list.length; i++) {
            let waybill_devices = [];
            let goods = _ruleForm.waybill_data_list[i].goods || [];
            _ruleForm.waybill_data_list[i].goods.forEach((good, index) => {
              good.sequence = index + "";
              good.waybill_devices &&
                good.waybill_devices.forEach((item) => {
                  if (
                    item.incubator_type ||
                    item.incubator_cnt ||
                    item.thermometer_id
                  )
                    waybill_devices.push({
                      ...item,
                      goods_id: good.id,
                      sequence: good.sequence,
                      start_time: item.start_time,
                    });
                });
            });
            _ruleForm.waybill_data_list[i].waybill_devices = waybill_devices;
          }
        }
        _ruleForm.waybill_data_list &&
          _ruleForm.waybill_data_list.forEach((item) => {
            item.delivery_money = parseFen(item.delivery_money);
            item.extra_distribution_fee = parseFen(item.extra_distribution_fee);
            item.second_distribution_fee = parseFen(
              item.second_distribution_fee
            );
            item.waiting_fee = parseFen(item.waiting_fee);
            item.total_expense =
              commonAddMulty(
                item.delivery_money,
                item.extra_distribution_fee,
                item.second_distribution_fee,
                item.waiting_fee,
                item.airport_pick_fee,
              ) + "";
          });
        if (this.mode === "add") {
          DistributionAddFn(_ruleForm).then((res) => {
            if (res && res.code === 10000) {
              if(this.judgeOver(res)) return;
              this.$message({
                message: "新建成功",
                type: "success",
              });
              this.$emit("update");
              this.$emit("updateFinish");
              this.submitLoading = false;
            } else {
              this.submitLoading = false;
            }
          });
        } else {
          const editFn =
            this.mode === "singleEdit"
              ? distributionEditOne
              : DistributionEditFn;
          DistributionEditFn(_ruleForm).then((res) => {
            if (res && res.code === 10000) {
              this.$message({
                message: "修改成功",
                type: "success",
              });
              this.$emit("update", false);
              this.$emit("updateFinish");
              this.submitLoading = false;
            } else {
              this.submitLoading = false;
            }
          });
        }
      });
    },
    handleClickReset() {},
    handleChangeDriver(val) {
      const driver = this.driverData.find((item) => item.id === Number(val));
      const { id, name, mobile } = driver;
      this.ruleForm.peron = name;
      this.ruleForm.mobile = mobile;
    },
    handleCostChange(val) {
      const cost = this.costData.find((item) => item.key === val);
      const { value } = cost;
      this.ruleForm.price = value;
    },
    handleSelectionChange() {},
    async handleClickBind(rowItem) {
      // 详情不能点击
      if (this.mode === "detail" || this.mode === "singleDetail") {
        return;
      }
      const waybillDevices = rowItem.waybill_devices || [];
      let startTime = "";
      startTime = (waybillDevices[0] || {}).start_time;
      const { start_time, checkedTemperatures } = await this.bindTemp(
        startTime,
        rowItem.waybill_devices
      );
      this.$set(rowItem, "start_time", start_time);
      this.$set(rowItem, "waybill_devices", checkedTemperatures);
    },
    handleChangeCompany(val) {
      const item = this.companyData.find((item) => item.id === Number(val));
      if (item) {
        this.ruleForm.company_id = val
        this.ruleForm["company"] = item.name;
        this.startAreaInfo={
          province_id:item.province_id,
          city_id:item.city_id,
          district_id:item.district_id,
        }
      } else {
        this.ruleForm.company_id = ""
        this.ruleForm["company"] = "";
        this.startAreaInfo={
          province_id:0,
          city_id:0,
          district_id:0,
        }
      }
      this.getFeeRules()
      // this.pageaccountingrules()
      // this.invokingNumber();
    },
    handleAddWaybill() {
      this.waybillDialogShow = true;
    },
    handleDelWaybill() {
      if (this.checkedRows.length === 0) {
        this.$message({
          message: "请选中后进行删除哦",
          type: "warning",
        });
        return;
      }
      if (this.ruleForm.waybill_data_list.length === this.checkedRows.length) {
        this.$message({
          message: "配送单下至少包含一个运单",
          type: "warning",
        });
        return;
      }
      this.ruleForm.waybill_data_list = this.ruleForm.waybill_data_list.filter(
        (item) => !this.checkedRows.includes(item.waybill_id)
      );
    },
    handleSelectionChange(checked) {
      this.checkedRows = checked.map((item) => item.waybill_id);
    },
    handleOperationWaybillOk(checkedWaybillIds) {
      const nowIds = this.ruleForm.waybill_data_list.map(
        (item) => item.waybill_id + ""
      );
      checkedWaybillIds = checkedWaybillIds.filter(
        (item) => !nowIds.includes(item + "")
      );
      this.getWaybillDataByIds(checkedWaybillIds);
      
    },
    handleOperationClose() {
      this.waybillDialogShow = false;
    },
    getWaybillDataByIds(ids) {
      const _ids = ids.map(Number);
      waybillRepo({ waybill_id_list: _ids }).then((res) => {
        if (res.data) {
          // this.ruleForm["waybill_data_list"] = res.data;
          this.ruleForm["waybill_data_list"] = (
            this.ruleForm["waybill_data_list"] || []
          ).concat(res.data);
          // 获取提货件数提货重量提货体积
          // this.invoking();
          this.getFeeRules()
        } else {
        }
      });
    },
    // 进入页面进行调用
    async invoking() {
      // await this.fromADDchange()
      // await this.TOADDchange()
      // this.pageaccountingrules()
    },
    // 干线始发地址改变的时候调用
    async fromADDchange() {
      let data = {
        detail_address: this.ruleForm.address_start,
      };
      this.startareaList = await this.PagerecognitionListcity(data);
    },
    // 干线目的地址改变的时候调用
    async TOADDchange() {
      let data = {
        detail_address: this.ruleForm.address_end,
      };
      this.endareaList = await this.PagerecognitionListcity(data);
    },
    // 详细地址转化
    async PagerecognitionListcity(value) {
      var resoluList = {};
      await recognitionListcity(value).then((res) => {
        resoluList = res.data;
      });
      return resoluList;
    },
    // 选中计费规则赋值
    rulechange(val) {
      const data=this.ruleCostInfo.find(item=>item.rule_id===val)
      if(data){
          this.curRuleCostId = data.rule_id
          this.curRuleCost = data;
      }else{
          this.curRuleCost={}
          this.curRuleCostId=""
      }
      this.allocatedMoney()
    },
    // 计费规则接口
    async getFeeRules(type, val) {
      // 不符合调用计费规则条件
      if(!this.isAccordRule){
        return;
      }
      let goodsInfo=[];
      this.ruleForm['waybill_data_list'].forEach(item=>{
        goodsInfo=goodsInfo.concat(item.goods)
      })
      // 计费规则调用
      var param = {
        node: "4", // 当前节点
        transport_type_id: this.waybillInfo.waybill_product_type + "", // 承运类型
        start_area_info: {
          province_id: this.startAreaInfo.province_id,
          city_id: this.startAreaInfo.city_id, // 省id
          district: this.startAreaInfo.district_id, // 市id
        }, // 出发区域信息
        end_area_info: {
          province_id: this.waybillInfo.receiver.province_id*1,
          city_id: this.waybillInfo.receiver.city_id*1, // 省id
          district: this.waybillInfo.receiver.district_id*1, // 市id
        }, // 到达区域信息
        carrier_id: this.ruleForm.company_id == undefined ? "" : this.ruleForm.company_id + "",  // 承运商id
        goods_list: goodsInfo
      }
        let result =await accountingrules(param)
        let data=result.data||[]
        this.ruleCostInfo = (data[0]||{}).rule_cost_info||[]
        // console.log(this.ruleCostInfo,'this.ruleCostInfo')
        if(this.ruleCostInfo.length!==0){
          this.rulechange(this.ruleCostInfo[0].rule_id)
        }else{
          this.rulechange("")
        }   
    },
    allocatedMoney(){
      if(this.mode!=='add'&&this.mode!=="singleAdd"){
       return;
      }
      if(Object.keys(this.curRuleCost).length==0){
        this.ruleForm['waybill_data_list'].forEach((item,index)=>{
          this.$set(
             this.ruleForm["waybill_data_list"][index],
             "delivery_money",
             ""
          );
        })
        return;
      }
     if(this.curRuleCost.billing_way==='8'){   
        this.allocatedMoneyByName('package_quantity')
     }else if(this.curRuleCost.billing_way==='1'){   
        this.allocatedMoneyByName('number')
     }else if(this.curRuleCost.billing_way==='2'){   
        this.allocatedMoneyByName('volume')
     }else if(this.curRuleCost.billing_way==='3'){   
        this.allocatedMoneyByName('weight')
     }
    },
    allocatedMoneyByName(name){
      let sum = this.ruleForm['waybill_data_list'].reduce((a,item)=>{
                  return a+item[name]*1
                },0)
      this.ruleForm['waybill_data_list'].forEach((item,index)=>{
         let cost= ((item[name]*1/sum)*this.curRuleCost.cost).toFixed(2)+''
         this.$set(
            this.ruleForm["waybill_data_list"][index],
            "delivery_money",
            cost
         );
      })
    },

    // 计费规则接口
    pageaccountingrules(type, val) {
      // this.rule_cost_info_id = ""
      // // 计费规则调用
      // var param = {
      //   node: "4", // 当前节点
      //   transport_type_id: this.waybillInfo.waybill_product_type + "", // 承运类型
      //   start_area_info: {
      //     address: this.ruleForm.address_start == undefined ? "" : this.ruleForm.address_start,
      //     province_id: this.startareaList.province_id, // 省id
      //     city_id: this.startareaList.city_id, // 市id
      //   }, // 出发区域信息
      //   end_area_info: {
      //     address: this.ruleForm.address_end,
      //     province_id: this.endareaList.province_id, // 省id
      //     city_id: this.endareaList.city_id, // 市id
      //   }, // 到达区域信息
      //   customer_id: this.waybillInfo.customer_id + "", // 客户id
      //   carrier_id: this.ruleForm.company_id == undefined ? "" : this.ruleForm.company_id + "",  // 承运商id
      //   goods_list: [
      //     {
      //       name: "",
      //       packing: "",
      //       goods_no: "",
      //       packing_type: "",
      //       number: this.ruleForm['waybill_data_list'][0].number + "",
      //       volume: this.ruleForm['waybill_data_list'][0].volume + "",
      //       weight: this.ruleForm['waybill_data_list'][0].newWeight + "",
      //       price: "",
      //       thermosphere: "",
      //       package_quantity: "",
      //       declared_value: "",
      //       remark: "",
      //     }
      //   ]
      // }
      // setTimeout(async () => {
      //   let result = await accountingrules(param)
      //   let datalist = JSON.parse(JSON.stringify(result.data))
      //   this.rule_cost_info = datalist[0].rule_cost_info
      //   if (this.rule_cost_info.length == 1 && this.ruleForm['waybill_data_list'][0].delivery_money == "") {
      //     this.rule_cost_info_id = this.rule_cost_info[0].rule_id
      //     this.rulechange(this.rule_cost_info[0].rule_id)
      //   } else if (this.rule_cost_info.length == 1) {
      //     this.rule_cost_info_id = this.rule_cost_info[0].rule_id
      //   }
      // });
    },


    // 修改件数重量和体积修改计费规则
    invokingNumber() {
      // this.$set(this.ruleForm['waybill_data_list'][0], 'delivery_money', "")
      // this.invoking()
    },
    selectCarNumber(e) {
      this.carNumberName = this.carNumberData.find(
        (item) => item.id == e
      ).license_plate;
    },
    //Notification 通知事件
    NotificationObj() {
      // console.log("函数调用");
      // 数据改变
      (this.noTifyData = {
        customer_id: this.waybillInfo.customer_id + "",
        product_type_id: this.waybillInfo.waybill_product_type,
        node_id: "4",
      }),
        (this.notifyType = true);
    },
  },
};
</script>
<style lang="scss" scoped>
.info_tab {
  width: 100%;
  height: 40px;
  background: #f2f3f5;
  font-weight: bold;
  line-height: 40px;
  padding-left: 12px;
  margin-bottom: 16px;
  color: #45474c;
  display: flex;
  .info_tab_list {
    display: flex;
    margin-left: 50px;
    font-size: 12px;
  }
}

.el-form--label-top .el-form-item__label {
  padding: 0 !important;
}

.el-table .cell .el-input.el-input--mini {
  width: auto !important;
}
</style>
